/*
 * File Name：AppInfoTable.java
 * Copyright：Copyright 2008-2014 CiWong.Inc. All Rights Reserved.
 * Description： AppInfoTable.java
 * Modify By：RES-KUNZHU
 * Modify Date：2014-2-28
 * Modify Type：Add
 */
package com.ciwong.epaper.util.download;

import android.provider.BaseColumns;
import android.util.Log;

/**
 * 文件下载详情表
 *
 * @author RES-KUNZHU
 * @version ciwong v.1.0 2014-2-28
 * @since ciwong v.1.0
 */
public class DownLoadTable implements BaseColumns
{
    /**
     * 应用数据表名字
     */
    public static final String TABLE_NAME = "downLoad";

    /**
     * 封面地址
     */
    public static final String ICON_URL = "ICON_URL";

    /**
     * 链接地址
     */
    public static final String URL = "URL";

    /**
     * 下载状态
     */
    public static final String STATUS = "STATUS";
    /**
     * 新老资源类型  资源力度拆分新增新的资源
     */
    public static final String TYPE = "TYPE";

    /**
     * 下载进度
     */
    public static final String PROGRESS = "PROGRESS";

    /**
     * 保存路径
     */
    public static final String SAVE_PATH = "SAVE_PATH";

    /**
     * 文件长度
     */
    public static final String LENGTH = "LENGTH";

    /**
     * 文件大小
     */
    public static final String SIZE = "SIZE";

    /**
     * 书籍id
     */
    public static final String BOOK_ID = "BOOK_ID";

    /**
     * 章节id
     */
    public static final String CHAPTER_ID = "CHAPTER_ID";

    /**
     * 新资源新增字段 模块id
     */
    public static final String MODULE_ID = "MODULE_ID";

    /**
     * 新资源新增字段 版本id
     */
    public static final String VERSION_ID = "VERSION_ID";


    /**
     * 书籍名称
     */
    public static final String BOOK_NAME = "BOOK_NAME";

    /**
     * 章节名称
     */
    public static final String CHAPTER_NAME = "CHAPTER_NAME";

    /**
     * key
     */
    public static final String KEY = "KEY";

    /**
     * 是否免费（1:免费 0:收费）
     */
    public static final String IS_FREE = "IS_FREE";

    /**
     * 是否是考试用书(1:考试)
     */
    public static final String IS_KAOSHI="IS_KAOSHI";

    /**
     * 资源包的HASH值 用于检测资源是否更新的
     */
    public static final String HASH="HASH";
    /**
     * 资源名称
     */
    public static final String RESOURCENAME="RESOURCENAME";
    /**
     * 基础资源类型
     */
    public static final String RESOURCETYPE = "RESOURCETYPE";
    public static final String SUBJECTID = "SUBJECTID";


    /**
     * sql语句
     */
    private static String createSql;

    static
    {
        StringBuffer sb = new StringBuffer();
        sb.append("create table " + TABLE_NAME + "(");
        sb.append(_ID + " integer primary key autoincrement,");
        sb.append(ICON_URL + " varchar(500),");
        sb.append(STATUS + " integer,");
        sb.append(TYPE + " integer,");
        sb.append(PROGRESS + " integer,");
        sb.append(SAVE_PATH + " varchar(200),");
        sb.append(LENGTH + " long,");
        sb.append(SIZE + " varchar(50),");
        sb.append(URL + " varchar(500),");
        sb.append(BOOK_ID + " varchar(50),");
        sb.append(CHAPTER_ID + " varchar(50),");
        sb.append(MODULE_ID + " varchar(50),");
        sb.append(VERSION_ID + " varchar(50),");
        sb.append(BOOK_NAME + " varchar(50),");
        sb.append(CHAPTER_NAME + " varchar(50),");
        sb.append(KEY + " text,");
        sb.append(IS_FREE + " integer,");
        sb.append(IS_KAOSHI + " integer,");
        sb.append(HASH + " varchar(200),");
        sb.append(RESOURCENAME+" varchar(200),");
        sb.append(RESOURCETYPE+" varchar(50),");
        sb.append(SUBJECTID+" integer)");
        createSql = sb.toString();
        Log.d("xixin","数据库---"+createSql);
    }

    public static String[] getColumns()
    {
        return new String[]{_ID, ICON_URL, STATUS,TYPE, PROGRESS, SAVE_PATH, LENGTH,
                SIZE, URL, BOOK_ID, CHAPTER_ID,MODULE_ID, VERSION_ID, BOOK_NAME, CHAPTER_NAME, KEY,
                IS_FREE,IS_KAOSHI,HASH,RESOURCENAME,RESOURCETYPE,SUBJECTID};
    }

    public static String getCreateSql()
    {
        return createSql;
    }

    public static void setCreateSql(String createSql)
    {
        DownLoadTable.createSql = createSql;
    }

}
